package com.example.rbac5.demo.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.rbac5.demo.entity.RolePower;
import com.example.rbac5.demo.mapper.RolePowerMapper;
import com.example.rbac5.demo.service.RolePowerService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author wuyunbin
 * @since 2023-11-08
 */
@Service
public class RolePowerServiceImpl extends ServiceImpl<RolePowerMapper, RolePower> implements RolePowerService {

    @Override
    public List<String> findPowerIdListByRoleId(String roleId) {
        LambdaQueryWrapper<RolePower> wrapper=new LambdaQueryWrapper<>();
        wrapper.eq(RolePower::getRoleId,roleId);
        List<RolePower> list = this.list(wrapper);
        List<String> powerIdList =new ArrayList<>();

        for (RolePower rolePower : list) {
            powerIdList.add(rolePower.getPowerId()) ;
        }
        return powerIdList;
    }
}
